package com.word.app.controller;

import java.util.*;

import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.word.app.controller.response.BaseResponse;
import com.word.app.pojo.dto.BaseRemReq;
import com.word.app.pojo.dto.PagingReq;
import com.word.app.service.impl.NormWordServiceImpl;

@RestController
@RequestMapping("/word")
public class WordController {
    @Autowired
	NormWordServiceImpl service = new NormWordServiceImpl();

    @RequiresPermissions(value={"perm:root", "perm:visitor"}, logical = Logical.OR)
    @PostMapping("query")
    BaseResponse query(@RequestBody PagingReq<BaseRemReq> req){
        return new BaseResponse().data(service.queryRememberByPage(req.getPage(), req.getParams()));
    }

    @RequiresPermissions(value={"perm:root", "perm:visitor"}, logical = Logical.OR)
    @PostMapping("updateRemember")
    void updateRemember(@RequestBody BaseRemReq<List> req){
        service.updateRemember(req);
    }

}
